package com.ruoyi.zsyh.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zsyh.mapper.ZsyhPlatformPartsattributeMapper;
import com.ruoyi.zsyh.domain.ZsyhPlatformPartsattribute;
import com.ruoyi.zsyh.service.IZsyhPlatformPartsattributeService;
import com.ruoyi.common.core.text.Convert;

/**
 * 产品规格管理Service业务层处理
 * 
 * @author yuexl
 * @date 2021-12-10
 */
@Service
public class ZsyhPlatformPartsattributeServiceImpl implements IZsyhPlatformPartsattributeService
{
    @Autowired
    private ZsyhPlatformPartsattributeMapper zsyhPlatformPartsattributeMapper;

    /**
     * 查询产品规格管理
     * 
     * @param id 产品规格管理ID
     * @return 产品规格管理
     */
    @Override
    public ZsyhPlatformPartsattribute selectZsyhPlatformPartsattributeById(String id)
    {
        return zsyhPlatformPartsattributeMapper.selectZsyhPlatformPartsattributeById(id);
    }

    /**
     * 查询产品规格管理列表
     * 
     * @param zsyhPlatformPartsattribute 产品规格管理
     * @return 产品规格管理
     */
    @Override
    public List<ZsyhPlatformPartsattribute> selectZsyhPlatformPartsattributeList(ZsyhPlatformPartsattribute zsyhPlatformPartsattribute)
    {
        return zsyhPlatformPartsattributeMapper.selectZsyhPlatformPartsattributeList(zsyhPlatformPartsattribute);
    }

    /**
     * 新增产品规格管理
     * 
     * @param zsyhPlatformPartsattribute 产品规格管理
     * @return 结果
     */
    @Override
    public int insertZsyhPlatformPartsattribute(ZsyhPlatformPartsattribute zsyhPlatformPartsattribute)
    {
        zsyhPlatformPartsattribute.setId(IdWorker.getId());
        zsyhPlatformPartsattribute.setCreateTime(DateUtils.getNowDate());
        return zsyhPlatformPartsattributeMapper.insertZsyhPlatformPartsattribute(zsyhPlatformPartsattribute);
    }

    /**
     * 修改产品规格管理
     * 
     * @param zsyhPlatformPartsattribute 产品规格管理
     * @return 结果
     */
    @Override
    public int updateZsyhPlatformPartsattribute(ZsyhPlatformPartsattribute zsyhPlatformPartsattribute)
    {
        zsyhPlatformPartsattribute.setUpdateTime(DateUtils.getNowDate());
        return zsyhPlatformPartsattributeMapper.updateZsyhPlatformPartsattribute(zsyhPlatformPartsattribute);
    }

    /**
     * 删除产品规格管理对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZsyhPlatformPartsattributeByIds(String ids)
    {
        return zsyhPlatformPartsattributeMapper.deleteZsyhPlatformPartsattributeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除产品规格管理信息
     * 
     * @param id 产品规格管理ID
     * @return 结果
     */
    @Override
    public int deleteZsyhPlatformPartsattributeById(String id)
    {
        return zsyhPlatformPartsattributeMapper.deleteZsyhPlatformPartsattributeById(id);
    }

    public List<ZsyhPlatformPartsattribute>  getAttributeListByIds(String ids){
        return zsyhPlatformPartsattributeMapper.getAttributeListByIds(Convert.toStrArray(ids));
    }

    @Override
    public int updateAttributeSort(int changeValue, String partsId, long attributeSort) {
        return zsyhPlatformPartsattributeMapper.updateAttributeSort(changeValue,partsId,attributeSort);
    }

    @Override
    public int updateAttributeSortBefore(int changeValue, String partsId, long attributeSort, long attributeSortOld) {
        return zsyhPlatformPartsattributeMapper.updateAttributeSortBefore(changeValue,partsId,attributeSort,attributeSortOld);
    }
}
